package utils;

/*
 * Basic pair utility class.
 */
public class IntTriple implements Comparable<IntTriple >{
	private int first;
	private int second;
	private int third;
	
	public IntTriple(int first, int second, int third) {
		this.first = first;
		this.second = second;
		this.third = third;
	}
	
	public int getFirst() {
		return first;
	}
	
	public int getSecond() {
		return second;
	}
	
	public int getThird() {
		return third;
	}
	
	public int compareTo(IntTriple other) {
		int comp = first - other.first;
		
		if (comp != 0) {
			return comp;
		} else {
			comp = second - other.second;
			if (comp != 0) {
				return comp;
			}
			return third - other.third;
		}
	}
	
	public boolean equals(Object other) {
		return compareTo((IntTriple)other) == 0;
	}
	
	public int hashCode() {return toString().hashCode();}
	
	public String toString() {
		return "<" + first + " , " + second + ", " + third + ">";
	}

	public int[] toArray() {
		return new int[] {first, second, third}; 
	}
}
